﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using Douban.Api;
using Douban.Api.User;
using Douban.Core;
using Douban.Modules.Friends.ViewModels;
using Douban.Modules.Friends.Views;
using Microsoft.Practices.Composite.Modularity;
using Microsoft.Practices.Composite.Regions;
using Microsoft.Practices.Unity;
using Douban.Core.Menus;
using Microsoft.Practices.Composite.Presentation.Commands;
using System.Windows.Threading;
using System.Threading;

namespace Douban.Modules.Friends
{
    public class FriendModule : IModule
    {
        private IUnityContainer Container { get; set; }

        public FriendModule(IUnityContainer container)
        {
            Container = container;
        }

        public void Initialize()
        {
            RegisterContainerObjects();
            Container.Resolve<FriendController>().Run();
        }
        
        private void RegisterContainerObjects()
        {
            Container
                .RegisterType<FriendController>(new ContainerControlledLifetimeManager())
                .RegisterType<IContactListView, FriendListView>()
                .RegisterType<IContactListViewModel, ContactListViewModel>();
        }
    }
}
